package com.fjec.devops.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjec.common.view.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "base-serv")
public interface BaseClient {
    @RequestMapping(method = RequestMethod.GET, value = "/api/annex/secret/base64/one")
    String getCredentialPicId(@RequestParam("bizId") Long bizId, @RequestParam("bizType") Integer bizType);

    @RequestMapping(method = RequestMethod.POST, value = "/api/annex/available/set")
    int enableAnnexStatus(@RequestBody List<AnnexBizItem> itemList);

    /**
     * 上传base64文件
     *
     * @param file     上传文件
     * @param fileName 文件名称
     * @param bizType  业务类型
     * @param bizId    业务Id
     * @param bizCode  业务自定义code
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/api/annex/base64Upload")
    Map<String, Object> base64Upload(@RequestParam String file,
                                     @RequestParam String fileName,
                                     @RequestParam Integer bizType,
                                     @RequestParam Long bizId,
                                     @RequestParam Integer bizCode
    );

    /**
     * 根据Id获取文件Base64
     *
     * @param id
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/api/annex/secret/base64/get")
    Map<String, Object> getOSSFileBase64ById(@RequestParam("id") Long id);


    /**
     * 分页查询资讯
     *
     * @param current
     * @param size
     * @param category
     * @param title
     * @param startTime
     * @param endTime
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/api/info/get/information/page")
    RpcReturnPage<InfoInformationVO> rpcGetInformationPage(@RequestParam long current,
                                                           @RequestParam long size,
                                                           @RequestParam(required = false) Integer category,
                                                           @RequestParam(required = false) String title,
                                                           @RequestParam(required = false) String startTime,
                                                           @RequestParam(required = false) String endTime,
                                                           @RequestParam(required = false) Integer getTop
    );

    /**
     * 保存资讯
     *
     * @param category       暂时不用传
     * @param id             资讯Id
     * @param title          标题
     * @param summary        简介
     * @param coverPic       封面url
     * @param articleContent 富文本内容
     * @param display        是否显示 0=不显示 1=显示
     * @param getTop         是否置顶 0=未置顶 1=已置顶
     * @param space          两边留白
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/api/info/save/information")
    boolean rpcSaveOrUpdateInformation(@RequestParam(required = false) Integer category,
                                       @RequestParam(required = false) Long id,
                                       @RequestParam(required = false) String title,
                                       @RequestParam(required = false) String summary,
                                       @RequestParam(required = false) String coverPic,
                                       @RequestParam String articleContent,
                                       @RequestParam Integer display,
                                       @RequestParam(required = false) Integer getTop,
                                       @RequestParam(required = false) Integer space
    );

    /**
     * 删除资讯
     *
     * @param id
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/api/info/del/information")
    boolean rpcLogicDelInformation(@RequestParam Long id);

    /**
     * 根据Id获取资讯
     *
     * @param id
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/api/info/get/by/id")
    InfoDetailVO rpcGetInfoDetail(@RequestParam Long id);


    /**
     * 后台查询轮播图列表
     *
     * @param current   分页条件
     * @param size      分页条件
     * @param markCode  市场编码 市场编码=1则为首页轮播图
     * @param startTime 开始时间
     * @param endTime   结束时间
     * @return
     * @throws Exception
     */
    @RequestMapping(method = RequestMethod.GET, value = "/api/rotation/get/page")
    RpcReturnPage<InfoRotationVO> rpcGetInfoRotationPage(@RequestParam long current,
                                                         @RequestParam long size,
                                                         @RequestParam(required = false) Integer markCode,
                                                         @RequestParam(required = false) String startTime,
                                                         @RequestParam(required = false) String endTime
    ) throws Exception;

    /**
     * 后台保存或更新轮播图信息
     *
     * @param id              主键Id 为空则为更新
     * @param markCode        市场编码 首页为1
     * @param title           标题
     * @param picId           轮播图Id
     * @param rotationPicUrl  轮播图Url
     * @param linked          是否跳转
     * @param rotationLinkUrl 跳转Url
     * @param sort            排序
     * @param display         是否显示 0=不显示 1=显示
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/api/rotation/save/or/update")
    boolean rpcSaveOrUpdateInfoRotation(@RequestParam(required = false) Long id,
                                        @RequestParam Integer markCode,
                                        @RequestParam String title,
                                        @RequestParam Long picId,
                                        @RequestParam String rotationPicUrl,
                                        @RequestParam Integer linked,
                                        @RequestParam String rotationLinkUrl,
                                        @RequestParam Integer sort,
                                        @RequestParam Integer display
    );

    /**
     * 后台根据Id获取详细信息
     *
     * @param id
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/api/rotation/get")
    InfoRotationVO rpcGetInfoRotationById(@RequestParam Long id) throws Exception;

    /**
     * 后台根据Id获取详细信息
     *
     * @param id
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/api/rotation/del")
    boolean rpcDelInfoRotation(@RequestParam Long id);


    /**
     * 根据市场编码获取轮播图 markCode=1则为首页轮播图
     *
     * @param markCode
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/api/rotation/list")
    List<Map<String, Object>> rpcGetInfoRotationByMarkCode(@RequestParam Integer markCode);

    /**
     * 根据markCode查询并根据sort排序
     *
     * @param markCode
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/api/rotation/get/by/markCode/sort")
    List<Map<String, Object>> rpcGetInfoRotationByMarkCodeAndSort(@RequestParam Integer markCode);
}
